<?php
/*
  $Id: whats_new.php,v 1.1.1.1 2004/03/04 23:42:16 ccwjr Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  CRE Loaded , Open Source E-Commerce Solutions
  http://www.creloaded.com
 
  Chain Reaction Works, Inc
  Portions: Copyright &copy; 2005 - 2006 Chain Reaction Works, Inc.
 	
 	Last Modified by $Author$
 	Last Modifed on : $Date$
 	Latest Revision : $Revision: 1075 $


  Released under the GNU General Public License
*/

  if ($random_product = tep_random_select("select p.products_id, p.products_image, pd.products_name, pd.products_description, p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and DATE_SUB(CURDATE(),INTERVAL " .NEW_PRODUCT_INTERVAL ." DAY) <= p.products_date_added and p.products_status = '1' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
?>
<!-- whats_new //-->
          <tr>
            <td class="product">
<?php
    
    $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);


// BOF Separate Pricing Per Customer
// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

  if(!tep_session_is_registered('sppc_customer_group_id')) {
  $customer_group_id = '0';
  } else {
   $customer_group_id = $sppc_customer_group_id;
  }

       if ($customer_group_id !='0') {
	$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $random_product['products_id'] . "' and customers_group_id =  '" . $customer_group_id . "'");
	  if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
	    $random_product['products_price'] = $customer_group_price['customers_group_price'];
	  }
     }
// EOF Separate Pricing Per Customer
//Eversun mod end for sppc and qty price breaks



    $info_box_contents = array();
$info_box_contents[] = array('text'  => '<font color="' . $font_color . '">' . BOX_HEADING_WHATS_NEW . '</font>');
    new infoBoxHeading_5($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW));

    
	
  	$box_img = tm_image_border('<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class="pic"') . '</a><br />');
	
	$box_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a>';

	$box_desc = substr($random_product['products_description'], 0, MAX_DESC_BOX) . '...';
	
	if (tep_not_null($random_product['specials_new_products_price'])) {
		
    	$box_price =  '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s>' . PRICE_SEPARATOR_BOX . '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
	
    } else {
		
    	$box_price =  '<span class="productSpecialPrice">'. $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])).'</span>';
    
	}
	
	

    $info_box_contents = array();
    $info_box_contents[] = array('align' => 'center',
                                
								 /*
                                 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $whats_new_price);
								 */
								 'text' => '
								 
								 		' . $box_img . '
								 		<br style="line-height:10px">
										' . $box_name . '<br>
										<br style="line-height:10px">
										' . $box_price . '
								 
								');
								
//Eversun mod for sppc and qty price breaks

    new infoBox_5($info_box_contents);
$info_box_contents = array();
  $info_box_contents[] = array('align' => 'center',
                                'text'  => tep_draw_separator('pixel_trans.gif', '100%', '1'));
//  new infoboxFooter($info_box_contents, true, true);

?>
            </td>
          </tr>
<!-- whats_new_eof //-->
<?php
  }
?>
